<?php
class EmptyAction extends CommonAction {    
	function _empty(){        
		header("HTTP/1.0 404 Not Found"); 
		$this->display('Public:404');  
	} 
	// 404 
	function index() { 
		header("HTTP/1.0 404 Not Found"); 
		Load('extend'); 
		$this->header_sibar();
        $product=M('Product');
        $pdata=$product->where('is_popular=1')->limit(4)->select();
        $this->assign('product',$pdata); 
        $hdata=$product->where('is_hot=1')->limit(2)->select();
        $this->assign('hproduct',$hdata);
        $newsoft=$product->order('add_time desc')->limit(12)->select();
        $this->assign('newsoft',$newsoft);
        $this->assign('flag',1);
		$this->display('Public:404'); 
	} 
	
 //读取头和左侧数据
    private function header_sibar(){
    	$Msystem=M("System");
        $system=$Msystem->find();
        $this->assign('title','Sorry, Page Not Found - www.iphone-mac.com');
        $this->assign('keyword','');
        $this->assign('description','The page you are looking for may no longer exist.');
        $this->assign('system',$system);
        $bigcategory=M('Bigcategory');
    	$cate=$bigcategory->order('add_time asc')->select();
    	foreach($cate as $k=>$v){
    		if(file_exists("./".$v['big_category_name'].'-software.html')){
    			$cate[$k]['file_exit'] = 1;
    		}
    	}
    	$this->assign('cate',$cate);
    	$plate=M('Plate');
    	$plate=$plate->field('think_plate.*,b.big_category_name  as bname')->join('left join think_bigcategory b on b.id=think_plate.pid')->order('think_plate.add_time asc')->select();
    	$this->assign('plate',$plate);
    	 $article=M('Article');
        $adata=$article->order('add_time desc')->limit(6)->select();
        $this->assign('article',$adata);
    	if(file_exists('./about-us.html')){
       		$this->assign('about_us',1);
       }
		if(file_exists('./contact-us.html')){
       		$this->assign('contact_us',1);
       }
		if(file_exists('./privacy-policy.html')){
       		$this->assign('privacy_policy',1);
       }
		if(file_exists('./terms-conditions.html')){
       		$this->assign('terms_conditions',1);
       }
    	if(file_exists('./links.html')){
       		$this->assign('links',1);
       }
    }
	//过滤html标签
	private function html($str){
		$pattern = "/(<strong>|<\/strong>|<br>|<br \/>)/i";
		return preg_replace($pattern,"",$str);
	}
} 

?>

